package com.xxwu.springblogsystem.service;

import com.xxwu.springblogsystem.mapper.BlogMapper;
import com.xxwu.springblogsystem.model.Blog;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BlogService {

    @Autowired
    private BlogMapper blogMapper;
    public List<Blog> queryBlogList(){
        return blogMapper.selectAll();
    }

    public Blog getBlogDetail(Integer id) {
        return blogMapper.selectById(id);
    }

    public Integer addBlog(Blog blog) {
        return blogMapper.insert(blog);
    }

    public Integer updateBlog(Blog blog) {
        return blogMapper.update(blog);
    }

    public Integer deleteBlog(Integer id) {
        return blogMapper.delete(id);
    }
}
